<extend name="Base/common"/>
<block name="style">
<link href="__CSS__/stylesheet.css" rel="stylesheet">
<link href="__CSS__/user.css" rel="stylesheet">
<style>
.order-comment-imgs img{width:80px;height:80px; margin-right:5px;}
</style>
</block>
<block name="header">
<header>
	<include file="User/header" />
</header>
</block>

<block name="body">
<div class="container main">

	<div class="user-main">
		<div class="col-xs-3">
			<include file="User/left_menu" />
		</div>
		<div class="col-xs-9">
			<h5>评价</h5>
			<form action="{:U('AjaxAction/goodscomment')}" method="post" class="form-horizontal" enctype="multipart/form-data">
			<div class="content order-comment">
				<div class="panel panel-border">
					<div class="panel-head">
						<input type="hidden" name='orderid' value="{$info.order_id}" />
						
						<span class="order-no">订单号：{$info.order_no}</span>
						<span class="order-time">{$info.crate_time|time_format=###,'Y-m-d'}</span>
					</div>
					<volist name="info['products']" id="volist">
					<div class="panel-main">					
						<a class="thumb" href="#"><img src="__ROOT__{$volist.image}" /></a>
						<p class="product-title">{$volist.product_title}</p>
						<p><em class="yen">￥</em><em class="price">{$volist.price}</em></p>
					</div>
					</volist>
				</div>
				<volist name="info['products']" id="volist">
				<div class="panel comment-level">
					<input type="hidden" name='productid[]' value="{$volist.product_id}" />
					<div class="panel-main">
						<div class="col-xs-12">商品：{$volist.product_title}</div>
						<div class="col-xs-2"><label>给宝贝评分：</label></div>
						<div class="col-xs-10">
							<div class="radios">
								<label class="radio"><input type="radio" name="rate[]" value="1" checked>好评</label>
								<label class="radio"><input type="radio" name="rate[]" value="2">中评</label>
								<label class="radio"><input type="radio" name="rate[]" value="3">差评</label>
							</div>
							<div class="order-comment-text">
								<textarea class="textarea" name="content[]" placeholder="说点什么"></textarea>
							</div>
							<div class="order-comment-imgs">
								<a  id="file_img" href="javascript:;">+</a>
							</div>
						</div>
					</div>
				</div>
				<div class="panel shop-comment-level">
					<div class="panel-main">
						<div class="col-xs-2"><label>给店铺评分：</label></div>
						<div class="col-xs-10">
							<ul>
								<li>
									<span>描述相符</span>
									<input type="hidden" name="rating_desc[]" />
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
								</li>
								<li>
									<span>服务态度</span>
									<input type="hidden" name="rating_attitude[]" />
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
								</li>
								<li>
									<span>发货速度</span>
									<input type="hidden" name="rating_speed[]" />
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
								</li>
								<li>
									<span>物流服务</span>
									<input type="hidden" name="rating_shipping[]" />
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
									<i class="icon-star-empty"></i>
								</li>
							</ul>
						</div>						
						
				</div>
			</div>
			</volist>
			</div>
			<div class="col-xs-3">
				<div class="form-group">
					<div class="button-control">
						<a href="#" class="btn  ajax-post" target-form="form-horizontal">确定</a>
					</div>	
				</div>
			</div>
			</form>
			
		</div>
	</div>
</div>
</block>

<block name="script">
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>					
<script type="text/javascript">
//上传图片
/* 初始化上传插件 */
$("#file_img").uploadify({      
	  "height"          : 80,
      "swf"             : "__STATIC__/uploadify/uploadify.swf",
      "fileObjName"     : "download",
      "buttonText"      : "+",
      "buttonClass"		: "btn",
      "uploader"        : "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
      "width"           : 80,
      'removeTimeout'	  : 1,
      'fileTypeExts'	  : '*.jpg; *.png; *.gif;',
      "onUploadSuccess" : uploadPicture_panel,
      'onFallback' : function() {
          alert('未检测到兼容版本的Flash.');
      }
});

function uploadPicture_panel(file, data){
   	var data = $.parseJSON(data);
   	src = data.url || "__ROOT__" + data.path;
   	if(data.status){
   		$(".order-comment-imgs").append(
   			"<input type=\"hidden\" name=\"cover_id[]\" value=\""+data.id+"\" />"+
   			"<a><img src=\""+src+"\"/></a>"
   		);
     } else {
     	updateAlert(data.info);
     	setTimeout(function(){
     		$('#top-alert').find('button').click();
     		$(that).removeClass('disabled').prop('disabled',false);
     	},1500);
     }
}

$(function(){
	$('.shop-comment-level i').click(function(i) {	
		var p=$(this).closest('li');
		p.find('i').removeClass('on');	
		index =p.find('i').index($(this));	
		p.find("input[type='hidden']").val(index + 1);
		$.each(p.find('i'), function(i, item) {
			if (i > index) {
				return;
			}
			$(item).addClass("on");
		});
		
	});
});

highlight_leftnav("{:U('User/orders',array('type'=>$type))}");
highlight_subnav("{:U('User/index')}");
</script>
</block>